package com.hospital.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import java.util.List;

/**
 * Created by wangjun on 2015/7/6.
 */
public class MyTextAdapter extends ArrayAdapter<String> {
    private OnItemClickListener mOnItemClickListener;



    public OnItemClickListener getmOnItemClickListener() {
        return mOnItemClickListener;
    }
    public void setmOnItemClickListener(OnItemClickListener mOnItemClickListener) {
        this.mOnItemClickListener = mOnItemClickListener;
    }
    public MyTextAdapter(Context context, int resource, List<String> namecates2) {
        super(context, resource,namecates2);
        // TODO Auto-generated constructor stub
    }
    public MyTextAdapter(Context context, int resource, String[] namecates2) {
        super(context, resource,namecates2);
        // TODO Auto-generated constructor stub
    }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        convertView=super.getView(position, convertView, parent);

        convertView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                mOnItemClickListener.onItemClick(position);

            }
        });
        return convertView;
    }



    public interface OnItemClickListener {
        public void onItemClick(int position);
    }

}
